<!DOCTYPE HTML>
<html>
<head>
<title>EnvUpdate | AutoHotkey</title>
<meta name="description" content="The EnvUpdate command notifies the OS and all running applications that environment variable(s) have changed." />
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link href="../static/theme.css" rel="stylesheet" type="text/css" />
<script src="../static/content.js" type="text/javascript"></script>
</head>
<body>

<h1>EnvUpdate</h1>

<p>通知操作系统和所有正在运行的程序<a href="../Concepts.htm#environment-variables">环境变量</a>已经改变.</p>

<pre class="Syntax"><span class="func">EnvUpdate</span></pre>
<h2>ErrorLevel</h2>
<p><span class="ver">[v1.1.04+]</span>: 此命令失败时会抛出异常. 想了解更多信息, 请参阅<a href="Catch.htm#RuntimeErrors">运行时错误</a>.</p>
<p>如果遇到问题则 <a href="../misc/ErrorLevel.htm">ErrorLevel</a> 被置为 1, 否则为 0.</p>
<h2>备注</h2>
<p>刷新操作系统环境. 效果类似于注销系统后再登录.</p>
<p>例如, 修改了后面的注册表键后, 可以用 EnvUpdate 来广播这个变化: <pre>HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session</pre></p>
<h2>相关</h2>
<p><a href="EnvSet.htm">EnvSet</a>, <a href="RegWrite.htm">RegWrite</a></p>
<h2>示例</h2>
<pre class="NoIndent">EnvUpdate</pre>

</body>
</html>